﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using TbShop.Entity;
using TbShop.Web.Helpers;

namespace TbShop.Web.Areas.Admin.Models
{
    public class TbCategoryViewModel : BaseViewModel
    {
        public string Name { set; get; }

        public int ParentId { set; get; }

        public string ImageUrl { set; get; }
        public int Sort { set; get; }

        public string TbCode { set; get; }
        public string TbSearch { set; get; }

        public string Class { set; get; }

        public List<SelectListItem> ParentCategorys
        {
            get
            {
                var result = CacheSelectItemHelper<TbCategory>.GetSelectList().ToList();
                if (result == null)
                    result = new List<SelectListItem>();
                result.Insert(0, new SelectListItem() { Text = "第一级分类", Value = "0" });
                return result;
            }
        }
    }
}